// variometer.h
//

#ifndef __VARIOMETER_H__
#define __VARIOMETER_H__

// maximum oversampling
#ifdef SENSOR_UNIT_TEST
#define SENSOR_OSS					0
#else
#define SENSOR_OSS					3
#endif

// temperature sample takes 4.5mS, pressure takes 25.5mS

//#define SENSOR_TEMP_ACQ_MS			 5
//#define SENSOR_PRESS_ACQ_MS			26

// ~47 samples per second
// ~ 3 second averaging window

//#define SENSOR_SAMPLES_PER_SEC        47
//#define SNS_NUM_Z_SAMPLES             140

//#define SENSOR_SAMPLES_PER_SEC        26
//#define SNS_NUM_Z_SAMPLES             78


#define SENSOR_SAMPLES_PER_SEC        34	// 40 sample per seconds
#define SNS_NUM_Z_SAMPLES             100


#define UART_DBG						0


void prs_LPFClimbRate(void);
void prs_TriggerPressureSample(void);
void prs_TriggerTemperatureSample(void);
u32  prs_ReadPressureSample(void);
u32  prs_ReadTemperatureSample(void);
s16  prs_CalcTemperatureCx10(void);
s32  prs_CalcPressurePa(void);
void prs_DeltaCmPerSec(void);
s32  prs_Pa2Cm(s32 pa);
void prs_AverageAltitude(void);
void prs_Init(void);
void prs_InitData(void);
void prs_InitWindowBuffers(void);
void prs_ReadCoeffs(void);
void prs_AcquireAveragedSample(int nSamples);
#ifdef SENSOR_UNIT_TEST
void prs_UnitTest(void);
#endif

#ifdef SENSOR_NOISE_EVAL
void prs_DumpAltitude(int nSamples, int pzInx);
#endif

void prs_SampleContinuous(void);
void prs_ProfileComputationTime(void);

#endif // __VARIOMETER_H__
